/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.view;

import java.util.Timer;
import java.util.TimerTask;

/**
 *
 * @author admin
 */
public class Tugas extends TimerTask{
private String name;
public Tugas(String name){
this.name = name;
}
@Override
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(i + " " + name);
}
}
}
class TimerExample {
public static void main(String[] args) {
Timer timer = new Timer();
timer.schedule(new Tugas("Bali"), 1000);
Timer timer1 = new Timer();
timer1.schedule(new Tugas("Jogja"), 0, 1000);
// apa beda kedua obyek timer ini
}
}
